﻿<div class="lrtm" ng-class="lrtm.getTaskInstances().length > 0 ? '' : 'inactive'">

    <div class="lrtm-summary">
        <b>{{ lrtm.downloadGeneratingCount() }}</b> reports generating, <b>{{ lrtm.downloadGeneratedCount() }}</b> reports ready for download, <b>{{ lrtm.downloadGenerateFailedCount() }}</b> reports could not be generated, <b>{{ lrtm.uploadingCount() }}</b> uploads in progress
    </div>

    <div class="clearfix"></div>

    <div class="lrtm-task" ng-repeat="taskInstance in lrtm.getTaskInstances()">
        <div class="lrtm-task-left">
            <div class="lrtm-task-progress">
                <span ng-if="taskInstance.status.taskStatus.progress">{{ taskInstance.status.taskStatus.progress | number: 0 }}%</span>
                <span ng-if="taskInstance.status.taskStatus.progress != 0 && !taskInstance.status.taskStatus.progress">?</span>
            </div>
        </div>
        <div class="lrtm-task-right">
            <div class="lrtm-task-title">
                <span>{{ taskInstance.status.title }}</span>
                <span ng-if="taskInstance.isDownloadGenerating()"> - generating</span>
                <span ng-if="taskInstance.isDownloadGenerated()"> - completed</span>
                <span ng-if="taskInstance.isDownloadGenerationFailed()"> - generation failed</span>
                <span ng-if="taskInstance.isUploading()"> - in progress</span>
                <span ng-if="taskInstance.isUploadComplete()"> - completed</span>
                <span ng-if="taskInstance.isUploadFailed()"> - failed</span>
            </div>
            <div class="lrtm-task-actions">
                <a ng-if="taskInstance.showCancel()" ng-class="taskInstance.canCancel() ? '' : 'inactive'" ng-click="$parent.lrtm.cancelTask(taskInstance);">Cancel</a>
                <a ng-if="taskInstance.showDownload()" ng-class="taskInstance.canDownload() ? '' : 'inactive'" ng-click="$parent.lrtm.downloadTask(taskInstance);">Download</a>
                <a ng-if="taskInstance.showClose()" ng-class="taskInstance.canClose() ? '' : 'inactive'" ng-click="$parent.lrtm.closeTask(taskInstance);">Ok</a>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>

    <div class="clearfix"></div>
</div>